#  ==============二手房源信息管理系统==========================
# ==================闭包 closure============
# def make_power(y):
#     def fn(x):
#         return x**y
#     return fn
#
# #用make——power 创建了一个能计算任何数的3次方的函数
# pow3 = make_power(3)
# print('2的3次方：',pow3(2))

#  ====================装饰器 decorators   @函数名======

# def passwrod(fn):
#
#     def wrp_func(name,x):
#         passwrod = input('请输入密码：')
#         if passwrod == '123456':
#             fn(name,x)
#         else:
#             print('密码输入错误')
#     return wrp_func
# def save_money(name,x):
#     print(name,'存钱',x,'元')
# @passwrod
# def withdraw(name, x):
#     print(name, '取', x, '元')
#
# withdraw('小邓',900)

#=======================================特性属性 @property
class Student:
    def __init__(self,s):
        self.__s = s
    @property
    def score(self):
        return self.__s
    @score.setter
    def score1(self,s):
        if s<0 or s>100:
            raise ValueError
        self.__s = s
        return '成功'


stu = Student(9)
#
# # print(stu.get_score())
# # print(stu.set_score(89))
# # print(stu.get_score())
#
print(stu.score)
stu.score1 = 78
print(stu.score)






